package cn.com.thingo.hyintelligent.ui.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.videogo.openapi.bean.EZDeviceInfo;

import java.util.List;

import cn.com.thingo.hyintelligent.R;

public class EzDeviceManagerListAdapter extends BaseQuickAdapter<EZDeviceInfo, BaseViewHolder> {
    public EzDeviceManagerListAdapter(@Nullable List<EZDeviceInfo> data) {
        super(R.layout.item_ezdevice_manager_list, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, EZDeviceInfo item) {
        helper.setText(R.id.tv_name, item.getDeviceName());
        ImageView imageView = helper.getView(R.id.iv_head);
        Glide.with(mContext).load(item.getDeviceCover()).apply(new RequestOptions().error(R.mipmap.default_head)
                .placeholder(R.mipmap.default_head).circleCrop().diskCacheStrategy(DiskCacheStrategy.ALL)).into(imageView);
        helper.addOnClickListener(R.id.tv_delete);
        helper.addOnClickListener(R.id.tv_auth);
    }
}
